package exabase.com;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Com {
	protected static Com instance;

	protected Client clientThread;
	protected PeerListener peerListener;

	protected Com() {
		try {
			peerListener = new PeerListener();
			clientThread = new Client();
		} catch (IOException e) {
			Logger.getLogger(Com.class.getName()).log(Level.SEVERE,
					"Server could not start because of a ", e);
		}
	}

	public static Com getInstance() {
		if (instance == null)
			instance = new Com();
		return instance;
	}

	public void go() {
		if (!peerListener.isAlive()) {
			peerListener.start();
		}
		if (!clientThread.isAlive()) {
			clientThread.start();
		}
	}
}
